function showInformTaskSearch(){
	window.location.href="showInformTaskSearch.do";
}

function ajaxFindInformTaskSearchList(currentPage,pageSize) {
	$.ajax({
		type:"post",
		url: "ajaxInformTaskSearchList.do",
		data:{
			currentPage:currentPage,
			pageSize:pageSize,
		},
		success:function(msg){
			$("#listInformTaskBox").html(msg);
		}
	});
}

function ajaxShowInformTaskEdit(id){
	$.ajax({
		type:"post",
		url:"ajaxShowInformTaskEdit.do",
		data:{informTaskId:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width: 800,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons: [
				          {
				        	  text: "保存",
				        	  click: function() {
				        		  ajaxSaveInformTask(this);
				        	  }
				          },
				          {
				        	  text: "关闭",
				        	  click: function() {
				        		  $(this).dialog( "close" );
				        	  }
				          }
				          ]
			});
		}
	});
}

function ajaxSaveInformTask(objDialog) {
	informTaskValidate();
	if ($("#frmInformTask").valid()) {
		$(objDialog).dialog("close");
		var options ={
				type: "post",
				url : "ajaxSaveInformTask.do",
				success: function (msg) {
					clearInput("#sltInformTask");
					ajaxFindInformTaskSearchList();
					showMessageDialog("提示","告知任务信息保存成功。",null,dialogType.info);
				}
		};
		$("#frmInformTask").ajaxSubmit(options);
	}
}

function ajaxShowInformTaskView(id){
	$.ajax({
		type:"post",
		url:"ajaxShowInformTaskView.do",
		data:{id:id},
		success:function(msg){
			$("#dialog").html(msg);
			$("#dialog").dialog({
				autoOpen: true,
				width: 750,
				title:$(".dialogtitle").attr("title"),
				modal: true,
				buttons : [ {
					text : "关闭",
					click : function() {
						$(this).dialog("close");
					}
				} ]
			});
		}
	});
}

function informTaskValidate(){
	$("#frmInformTask").validate({
		errorLabelContainer: $("#infoInformTask"),
		rules : {
			sectionname : {
				required :true				
			},
			endmeter : {
				required :true,
			}
		},
		messages : {
			sectionname : {
				required :"请输入路段名称！"
			},
			endmeter : {
				required :"请输入结束米数！",
			}
		},
		success: function(label) {
			label.html("&nbsp;");
		}
	});
}